URLStatus
Type
function
Summary
Returns the status of uploads and downloads that were started with the load, libURLDownloadToFile, libURLftpUpload, and libURLftpUploadFile commands.
Syntax
the URLStatus of <url>
URLStatus(<url>)
Description
Use the URLStatus function to check the progress of an upload or download.
You can check the cachedURLs function to determine whether a URL has already been downloaded. The URL is not placed in the cachedURLs until the download is complete, however, so you must use the URLStatus function to check a pending download or one that has been started but not finished.
To update a progress indicator or perform other tasks during uploads and downloads, use the libURLSetStatusCallback command to automatically send a callback message every time the URLStatus function is updated. You can then write a handler for this message that performs whatever tasks are needed.
The third item (bytesTotal) in the "loading" or "uploading" status report is empty if it is not possible to determine the total file size. (For example, if an FTP server does not support the SIZE command, it's not possible to determine the file size when downloading a file from that server.)
If an error occurs during downloading, the URLStatus function returns "error". You can get the error message using the libURLErrorData function.
The URLStatus function is part of the Internet library. To ensure that the function works in a standalone application, you must include this custom library when you create your standalone. In the Inclusions pane of the Standalone Application Settings window, make sure the "Internet" script library is selected.
Parameters
Name | Type | Description |
---|---|---|
url | A URL, or an expression that evaluates to a URL. |
Examples
the URLStatus of "http://www.example.com/test.html"
wait until URLStatus(field "URL") is "cached"
if URLStatus(myFile) is "error" then get libURLErrorData(myFile)
Related
library: Internet library
command: post, libURLftpUploadFile, libURLftpUpload, libURLDownloadToFile, load, libURLSetStatusCallback
control structure: function
function: libURLLastRHHeaders, libURLErrorData, URLStatus, cachedURLs
glossary: FTP, return, standalone application, cache, command, callback, Standalone Application Settings, upload, download, message, server, handler, LiveCode custom library
keyword: URL
Compatibility and Support
Introduced
LiveCode 1.0
OS
mac
windows
linux
web
Platforms
desktop
server